home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0385.arc
/
MATMAN.TST
< prev
next >
Wrap
Text File
|
1986-02-27
|
3KB
|
90 lines
The automatic test program for module MatMan
by Namir Clement Shammas
MODULE AutoTest;
(* Module to test matrix management module, MatMan *)
FROM MatMan IMPORT HIROW, Loc, Loc0, LOC, LOC0, SwapColumn, SwapRow,
Transpose, InsertColumn, InsertRow, ResizeMat,
DeleteRow, DeleteColumn;
FROM RealInOut IMPORT WriteReal;
FROM InOut IMPORT Read, WriteLn, WriteString;
VAR X, Z : ARRAY [1..25] OF REAL; (* Pseudo-matrices *)
Y : ARRAY [1..5] OF REAL; (* Row/Column *)
HICOL, I, J : CARDINAL; (* Counters and indices *)
DUM : CHAR; (* Dummy variable *)
PROCEDURE PAUSE;
(* Procedure used to pause in between displays *)
BEGIN
WriteString('PRESS ANY KEY TO CONTINUE');
Read(DUM); WriteLn; WriteLn;
END PAUSE;è
PROCEDURE SHOW;
(* Show the current matrix *)
BEGIN
FOR I := 1 TO HIROW DO
FOR J := 1 TO HICOL DO
WriteReal(X[Loc(I,J)],10);
WriteString(' ')
END;
WriteLn;
END;
END SHOW;
BEGIN (* MAIN *)
HICOL := 3;
HIROW := 3;
(* Initialize pseudo-matrix x and array Y *)
FOR I := 1 TO HIROW DO
FOR J := 1 TO HICOL DO
X[Loc(I,J)] := 1.0
END;
Y[I] := 2.0
END;
Y[4] := 2.0; Y[5] := 2.0;
WriteString('Initial matrix is'); WriteLn;
SHOW; PAUSE;
WriteString('Matrix after inserting row Y in column 2'); WriteLn;
InsertColumn(X,Y,2,HIROW,HICOL); SHOW; PAUSE;
FOR I := 1 TO 5 DO
Y[I] := 3.0
END;
WriteString('Matrix after inserting row Y in row 2 '); WriteLn;
InsertRow(X,Y,2,HIROW,HICOL); SHOW; PAUSE;
WriteString('Matrix Z'); WriteLn;
Transpose(X,Z,HIROW,HICOL);
FOR I := 1 TO HICOL DO
FOR J := 1 TO HIROW DO
WriteReal(Z[Loc(I,J)],10);
WriteString(' ')
END;
WriteLn
END;
WriteString('Matrix after swapping columns 2 and 1 '); WriteLn;
SwapColumn(X,1,2,HIROW); SHOW; PAUSE;
WriteString('Matrix after swapping rows 2 and 3'); WriteLn;
SwapRow(X,2,3,HIROW,HICOL); SHOW; PAUSE;
WriteString('Matrix after deleting column 2'); WriteLn;è DeleteColumn(X,2,HIROW,HICOL); SHOW; PAUSE;
WriteString('Matrix after deleteing row 2 '); WriteLn;
DeleteRow(X,2,HICOL,HIROW); SHOW; PAUSE;
WriteString('Matrix after being resized to 2 row'); WriteLn;
ResizeMat(X,HIROW,2,HICOL); HIROW := 2; SHOW; PAUSE;
END AutoTest.